<template>
  <view style="position: relative;">
    <view class="mp-search-box" ref="head" :style="{backgroundColor:titleNViewBackground}" style="padding-top: 0upx;">
      <image src="../../static/72x72.png" style="width: 50upx;height: 50upx;position: absolute;top: 80upx;left: 25upx;"
        mode="" @click="jumpgo" data-src='/pages/us/us'></image>
      <image src="../../static/fangdajing.png" style="width: 40upx;height: 40upx;position: absolute;top: 80upx;left: 100upx;z-index: 2;"
        @click="searchgoGoods"></image>
      <input class="ser-input" type="text" placeholder="输入关键字搜索" style="position: absolute;top: 70upx;left: 90upx;"
        placeholder-style="color:#aaa;font-size:28upx" @click="searchgoGoods" />
      <image @click="jumpgo" data-src='/pages/media/media' src="../../static/xiaoxi1.png" style="width: 48upx;height: 48upx;position: absolute;top: 80upx;right: 25upx;"></image>
    </view>
    <view v-for="(res,index) in data" :key="index">
      <!-- 头部轮播 banner -->
      <view v-if="res.id == 'banner'">
        <view class="carousel-section">
          <view class="titleNview-placing"></view>
          <view class="titleNview-background" :style="{backgroundColor:titleNViewBackground}"></view>
          <swiper class="carousel" circular autoplay duration="1000" @change="swiperChange">
            <swiper-item v-for="(item, index) in res.data" :key="index" class="carousel-item">
              <image :src="item.imgurl" mode="" @click="jumptomenu(item)" />
            </swiper-item>
          </swiper>
          <!-- <view class="swiper-dots">
						<text class="num">{{swiperCurrent+1}}</text>
						<text class="sign">/</text>
						<text class="num">{{swiperLength}}</text>
					</view> -->
        </view>
        <!-- <swiper autoplay="true" indicator-dots="true" circular="true" style="height: 422upx;">
					<swiper-item v-for="(item,i) in res.data" :key="i" @click="jumptomenu(item)">
						<image :src="item.imgurl"  style="height: 422upx;width: 100%;" model="aspectFill" />
					</swiper-item>
				</swiper> -->
      </view>

      <!-- menu2 -->
      <view v-if="res.id == 'menu2'">
        <view class="tab_choose">
          <text class="menu_son">
            <text class="iconfont">&#xe654; </text>
            <text class="padleft"> 自购轻松省</text>
          </text>
          <text class="menu_son">
            <text class="iconfont">&#xe654; </text>
            <text class="padleft"> 分享简单赚</text>
          </text>
          <text class="menu_son">
            <text class="iconfont">&#xe654;</text>
            <text class="padleft"> 百分百正品</text>
          </text>
        </view>
      </view>
      <!-- blank -->
      <view v-if="res.id == 'blank'">
        <view :style="{background:res.style.background,height:res.style.height *2 + 'upx'}"></view>
      </view>
      <!-- title -->
      <view v-if="res.id == 'title'">
        <view class="d-header" style="font-weight: 555;height: 110upx;line-height: 110upx;">
          <text v-if="res.params.title">{{res.params.title}}</text>
        </view>
      </view>
      <!-- menu -->
      <view v-if="res.id == 'menu'">
        <swiper v-if="res.data_temp" indicator-dots="true" style="height: 222upx;" :style="{background:res.style.background}">
          <swiper-item v-for="(menu,index1) in res.data_temp" :key="index1" class="webkit">
            <view v-for="(item,index2) in menu" :key="index2" style="width: 150upx;padding: 20upx 0;" @click="jumptomenu(item)"
              data-src='item.linkurl'>
              <image :src="item.imgurl" style="width: 88upx;height: 88upx;margin: 0 auto;display: block;"></image>
              <text style="display: block;text-align: center;font-size: 24upx;padding: 8upx;" :style="{color:item.color}">{{item.text}}</text>
            </view>
          </swiper-item>
        </swiper>
        <view v-else class="webkit flexbox">
          <view v-for="(item,i) in res.data" :key="i" :style="{background:res.style.background,width: 100 /res.style.rownum +'%'}"
            @click="jumptomenu(item)" style="padding: 20upx 0;" class="flexboxson">
            <image :src="item.imgurl" style="width: 88upx;height: 88upx;margin: 0 auto;display: block;"></image>
            <text style="display: block;text-align: center;font-size: 32upx;padding: 8upx;" :style="{color: item.color}">{{item.text}}</text>
          </view>
        </view>
      </view>
      <view @click="tozutuan" v-if="res.id == 'menu'" style="color: #000;font-size: 28upx;width: 94%;margin: 30upx 3%;">
        <view v-if="tuan.error==0" style="display: flex;background-color: #F1F1F1;border-radius: 25upx;justify-content: space-around;">
          <view style="display: flex;">
            <view class="">
              <image style="width: 100upx;height: 100upx;" src="../../static/20.png" mode=""></image>
            </view>
            <view style="margin-left: 30upx;">
              <swiper vertical="true" autoplay interval='2000' circular style="width: 300upx;height: 100upx;line-height: 50upx;">
                <swiper-item>
                  <view style="display: flex;">
                    <view style="width: 10upx;height: 10upx;background-color: #f00;border-radius: 15upx;margin-top: 20upx;margin-right: 10upx;"></view>
                    <view class="">
                      我在当前组中排第 <text style="color: #f00;">{{tuan.user_wei}}</text>位
                    </view>
                  </view>
                  <view style="display: flex;">
                    <view style="width: 10upx;height: 10upx;background-color: #f00;border-radius: 15upx;margin-top: 20upx;margin-right: 10upx;"></view>
                    <view class="">
                      我排在第<text style="color: #f00;">{{tuan.tuan_wei}}</text>组
                    </view>
                  </view>
                </swiper-item>
                <swiper-item v-if="tuan.sy_count !==0" style="line-height: 100upx;">
                  <view style="display: flex;">
                    <view style="width: 10upx;height: 10upx;background-color: #f00;border-radius: 15upx;margin-top: 47upx;margin-right: 10upx;"></view>
                    <view>
                      当前还差<text style="color: #f00;">{{tuan.sy_count}}</text>人开组
                    </view>
                  </view>
                </swiper-item>
              </swiper>
            </view>
          </view>
          <view style="line-height: 100upx;">
            <uni-icons type="arrowright" size="35"></uni-icons>
          </view>
        </view>
      </view>
      <!-- notice  公告-->
      <view v-if="res.id == 'notice'">
        <view class="uni-swiper-msg" :style="{background:res.style.background}" style="padding: 12upx;width: 726upx;">
          <view class="uni-swiper-msg-icon" style="width: 70upx;">
            <view style="color: #b25415;padding-left: 10upx;">热点</view>
          </view>
          <image src="../../static/notification.png" style="width: 32upx;height: 32upx;margin-top: 10upx;margin-right: 12px;"
            mode=""></image>
          <swiper vertical="true" autoplay="true" circular="true" interval="3000" class="flex">
            <swiper-item v-for="(item, index3) in res.data" :key="index3">
              <navigator :style="{color:res.style.color}" style="font-size: 24upx;" class="ellipsis-1">{{item.title}}</navigator>
            </swiper-item>
          </swiper>
        </view>
      </view>

      <view v-if="res.id == 'picturew'">
        <view v-if="res.params.row == '4'" style="display: flex;">
          <view style="width: 400upx;height: 200upx;margin: 5upx;" v-for="(item,index4) in res.data" :key="index4">
            <image :src="item.imgurl" style="width: 100%;height: 100%;" mode="widthFix" @click="jumptomenu(item)"></image>
          </view>
        </view>
        <!-- 堆积两列 -->
        <view v-if="res.params.row == '2'">
          <view style="width: 360upx;height: 200upx;margin: 5upx;display: inline-block;" v-for="(item,index4) in res.data"
            :key="index4">
            <image :src="item.imgurl" style="width: 100%;height: 100%;" mode="widthFix" @click="jumptomenu(item)"></image>
          </view>
        </view>
        <!-- 堆积三列 -->
        <view v-if="res.params.row == '3'">
          <view style="width: 240upx;height: 200upx;margin: 5upx;display: inline-block;" v-for="(item,index4) in res.data"
            :key="index4">
            <image :src="item.imgurl" style="width: 100%;height: 100%;" @click="jumptomenu(item)"></image>
          </view>
        </view>
        <!-- picturew 橱窗布局 -->
        <view v-if="res.params.row == '1'" class="p_father">
          <view class="p_left">
            <image :src="picturew[0].imgurl" @click="jumptomenu(picturew[0])"></image>
            <!-- @click="jump_1" -->
          </view>
          <view class="p_right">
            <view class="img_top">
              <image :src="picturew[1].imgurl" @click="jumptomenu(picturew[1])"></image>
            </view>
            <view class="img_bottom" v-if="picturew[2]">
              <view>
                <image :src="picturew[2].imgurl" @click="jumptomenu(picturew[2])"></image>
              </view>
              <view v-if="picturew[3]">
                <image :src="picturew[3].imgurl" @click="jumptomenu(picturew[3])"></image>
              </view>
            </view>
          </view>
        </view>
      </view>



      <view v-if="res.id == 'blank'" :style="{background:res.style.background,'height': res.style.height+'px'}"></view>


      <!-- picture -->
      <view v-if="res.id == 'picture'" style="overflow: hidden;margin: 0 20upx;">
        <image v-for="(item,index5) in res.data" :key="index5" :src="item.imgurl" style="width: 100%;" :style="{'padding-right':res.style.paddingleft * 2 +'upx','padding-top':res.style.paddingtop * 2 +'upx','padding-bottom':res.style.paddingtop * 2 +'upx'}"
          @click="jumptomenu(item)" mode="widthFix"></image>
        <view v-for="(item,index5) in res.data" :key="index5" v-if="is_buy == 1&&item.imgurl=='http://hszj.hongshantang696.com//attachment/images/4/2020/10/CJb7J4l8j04rL0M47WBJTAN0OuJYBy.png'"
          style="text-align: center;font-weight: bold;color: #800080;margin: 50upx 0;font-size: 38upx;">
          您已获得参团资格
        </view>
      </view>
      <!-- goods 商品主题场列表-->
      <view v-if="res.id == 'goods'" class="clear" :class="res.style.liststyle">
        <view v-for="(item,i) in res.data" :key="i" class="item" @click="jumpgoods" :data-id='item.gid'>
          <image class="triangle" :src="item.thumb"></image>
          <view class="detail">
            <view class="name" :style="{color:res.style.titlecolor}">{{item.title}}</view>
            <view class='productprice' v-if="res.params.showproductprice == 1" :style="{color:res.style.productpricecolor}"
              style="position: relative;">
              <text style="text-decoration:line-through;">{{res.params.productpricetext}}{{item.productprice}}</text>
              <text v-if="res.params.showsales != 1" style="position: absolute;right: 0;top: 0;">库存{{item.total}}</text>
            </view>
            <view class='sale' v-if="res.params.showsales == 1" :style="{color:res.style.salescolor}" style="position: relative;">
              <text>{{res.params.salestext}}{{item.sales}}</text>
              <text style="position: absolute;right: 0;top: 0;">库存{{item.total}}</text>
            </view>
            <view class="price webkit" v-if="res.params.showprice == 1">
              <text style="font-size: 28upx;" class="flex">¥{{item.price}}</text>
            </view>
          </view>
        </view>
      </view>

      <!-- update -->
      <view class="mask" :class="show" @touchmove.stop.prevent="hide"></view>
      <view class="mask" :class="show2" @touchmove.stop.prevent="hide"></view>
      <view class="gengxing" :class="show2" :style="{pointerEvents:pointerevents}">
        <image src="../../static/update_bg3.png" style="width: 480upx;height: 732upx;position: absolute;bottom: 0;z-index: 2;"></image>
        <!-- 更新进度条 -->
        <view v-if="show8 == 0">
          <view style="background: rgba(255, 0, 0, 0.2);width: 480upx;height: 100upx;position: absolute;z-index: 9999;bottom: 0;"
            :style="{'right':right}"></view>
          <view class="title">发现新版本<text>{{version}}</text></view>
          <view style="position:absolute;bottom:310upx;width:100%;text-align:center;z-index: 999;color: #db3737;">{{newtext}}</view>
          <view style="position:absolute;top:460upx;width:100%;text-align:center;">

          </view>
          <button class="dl" @click="download" v-if="link == '4G'">{{dlbtn}}</button>
          <button class="dl" v-else>{{dlbtn}}</button>
        </view>
      </view>

    </view>
    <!-- <yangr-msg v-if="yangrMsgShow" :title="title" type="success" :info="info" btn="同意" @yangrMsgEvent="closeYangrMsg"></yangr-msg> -->
  </view>
</template>

<script>
  // import yangrMsg from "@/components/yangr-msg/yangr-msg.vue"
  import uniPopup from '@/components/uni-popup/uni-popup.vue'
  import uniPopupMessage from '@/components/uni-popup/uni-popup-message.vue'
  import uniPopupDialog from '@/components/uni-popup/uni-popup-dialog.vue'
  import uniIcon from '@/components/uni-icon.vue'
  import uniCountdown from '@/components/uni-countdown/uni-countdown.vue'
  import BottomImageMenu from '@/components/bottom-mask/bottom-mask.js'
  // #ifdef APP-PLUS
  var bottomImageMenu = new BottomImageMenu(() => {})
  // #endif
  export default {
    components: {
      // yangrMsg,
      uniIcon,
      uniCountdown,
      uniPopup,
      uniPopupMessage,
      uniPopupDialog
    },
    onShareAppMessage(res) {
      if (res.from === 'button') { // 来自页面内分享按钮
      }
      if (this.pid_father == '' || this.pid_father == undefined || this.pid_father == null) {
        uni.navigateTo({
          url: '../login/login'
        })
      }
      return {
        title: 'adkk商城',
        path: '/pages/home/home?pid=' + this.pid_father
      }
    },
    onReady: function() {
      this.show8 = 0
    },
    data() {
      return {
        title: '用户协议',
        info: '',
        yangrMsgShow: false,
        openid: '',
        data: {},
        appversion: '',
        version: '',
        show: '',
        show2: "",
        show3: 'show',
        show8: '',
        link: "",
        dlbtn: "",
        newtext: "",
        right: '100%',
        titleNViewBackground: '', //轮播图区域
        swiperCurrent: 0,
        swiperLength: 0,
        goodsList: [],
        backgroundColor: 'transpant',
        pointerevents: 'auto',
        ad: true,
        video_show: true,
        adv: {},
        autoclose: '',
        picturew: [],
        background: '',
        muted: false,
        path: 'http://hszj.hongshantang696.com//video.mp4',
        pid_father: '',
        tongyi: '',
        is_buy: '',
        tuan: {},
      };
    },
    onShow: function() {
      this.yangrMsgShow = true;
      uni.getStorage({
        key: 'openid',
        success: (res) => {
          this.openid = res.data
          this.kaituan()
        },
      });

      if (this.openid) {
        uni.request({
          url: 'http://hszj.hongshantang696.com//app/index.php?i=4&c=entry&m=ewei_shopv2&do=mobile&r=acommsion.getappversion&app=1',
          data: {
            openid: this.openid
          },
          header: {
            'Content-Type': 'application/x-www-form-urlencoded'
          },
          method: 'POST',
          success: res => {
            console.log(res)
            this.is_buy = res.data.is_buy
          },
          fail: () => {},
          complete: () => {},
        });
      }
    },
    onLoad: function(e) {
      // this.muted = false
      let o = this
      uni.getStorage({
        key: 'pid_father', // 个人中心页获取的分享id
        success: (res) => {
          this.pid_father = res.data
        }
      });
      uni.request({
        url: 'http://hszj.hongshantang696.com//app/index.php?i=4&c=entry&m=ewei_shopv2&do=mobile&app=1',
        success: res => {
          this.data = res.data
          // 处理广告栏数据
          this.adv = res.data.adv
          if (this.adv.data != null || this.adv.data != undefined) {
            this.autoclose = res.data.adv.params.autoclose
            if (this.adv.status == 1) {
              setTimeout(function() {
                o.show3 = ''
              }, o.autoclose * 1000);
            }
          } else {
            this.ad = false
          }
          // 处理返回数据
          for (var i in this.data) {
            if (this.data[i].id == 'menu') {
              if (this.data[i].data_temp == undefined) {
                this.data[i].style.width = 375 / this.data[i].style.rownum + 'px'
              }
            }
            if (this.data[i].id == 'banner') {
              let a = this.data[i].data
              var count = 0;
              for (var i in a) {
                if (a.hasOwnProperty(i)) {
                  count++;
                }
              }
              this.swiperLength = count
              for (let j in a) {
                // console.log(a[j])
                this.titleNViewBackground = a[j].backgrounds
                return
              }
            }
          }
        },
        fail: () => {},
        complete: () => {}
      });
      if (uni.getSystemInfoSync().platform === 'android') {
        uni.request({
          url: 'http://hszj.hongshantang696.com//app/index.php?i=4&c=entry&m=ewei_shopv2&do=mobile&r=acommsion.getappversion&app=1',
          data: {
            openid: this.openid
          },
          header: {
            'Content-Type': 'application/x-www-form-urlencoded'
          },
          method: 'POST',
          success: res => {
            this.tongyi = res.data.tongyi
            if (this.tongyi == 1) {
              this.open()
              uni.hideTabBar({})
            }
            //#ifdef APP-PLUS
            this.tongyi = res.data.tongyi
            if (this.tongyi == 1) {
              this.open()
              uni.hideTabBar({})
            }
            var edition = plus.runtime.version //获取当前版本号：1.0.1
            //将版本号转变为101格式
            edition = edition.split(".")
            var ary = ''
            for (var i in edition) {
              ary += edition[i]
            }
            // if (res.data.version > ary) { //判断如果版本低于服务器版本
            if (res.data.version != ary) { //判断如果版本低于服务器版本
              console.log(res.data.version)
              console.log(ary)
              this.ad = false // 更新时阻止弹出系统广告
              //将版本号101转变为1.0.1格式
              var newversion = ''
              for (var i in res.data.version) {
                newversion += res.data.version[i] + '.'
              }
              this.version = newversion.slice(0, newversion.length - 1)
              //------------------
              this.show2 = 'show' //蒙版出现
              bottomImageMenu.show() // 遮挡底部菜单栏的蒙版
              if (plus.networkinfo.getCurrentType() != 3) { //如果不是WIFI
                this.link = '4G'
                this.dlbtn = '使用流量下载'
                this.newtext = '您当前未使用wifi，已停止下载'
                var nowlink = setInterval(() => {
                  if (plus.networkinfo.getCurrentType() == 3) {
                    clearInterval(nowlink)
                    this.download() //下载
                  }
                }, 2000)
              } else {
                this.download() //下载
              }
            }
            //#endif
          },
          fail: () => {},
          complete: () => {},
        });
      }
      if (uni.getSystemInfoSync().platform === 'ios') {
        uni.request({
          url: 'http://hszj.hongshantang696.com//app/index.php?i=4&c=entry&m=ewei_shopv2&do=mobile&r=acommsion.getappversion&app=1',
          method: 'POST',
          success: res => {
            //#ifdef APP-PLUS
            console.log(res.data)
            var edition = plus.runtime.version //获取当前版本号：1.0.1

            //将版本号转变为101格式
            edition = edition.split(".")
            var ary = ''
            for (var i in edition) {
              ary += edition[i]
            }
            // if (res.data.version > ary) { //判断如果版本低于服务器版本
            if (res.data.ios != ary) { //判断如果版本低于服务器版本
              // console.log(res.data.ios)
              // console.log(ary)
              this.ad = false // 更新时阻止弹出系统广告
              //将版本号101转变为1.0.1格式
              // var newversion = ''
              // for (var i in res.data.version) {
              // 	newversion += res.data.version[i] + '.'
              // }
              // this.version = newversion.slice(0, newversion.length - 1)
              //------------------
              uni.showModal({
                title: "更新",
                content: '有新的功能推送哦~',
                success: function(res) {
                  if (res.confirm) {
                    plus.runtime.openURL(
                      'http://hszj.hongshantang696.com//app/index.php?i=4&c=entry&m=ewei_shopv2&do=mobile&r=account.download'
                    )
                  } else if (res.cancel) {
                    // console.log('用户点击取消');
                  }
                }
              })
            }
            //#endif
          },
          fail: () => {},
          complete: () => {},
        });
      }
    },
    // onHide () {
    // 	this.muted = true
    // },
    methods: {
      closeYangrMsg() {
        this.yangrMsgShow = false;
      },
      // 页面滚动事件
      // onPageScroll(){
      // 	// if (scrollTop<=100) {
      // 	// 	this.backgroundColor = 'black'
      // 	// }
      // 	this.backgroundColor = '#C45952'
      // },
      //轮播图切换修改背景色
      swiperChange(e) {
        const index = e.detail.current;
        this.swiperCurrent = index;
        var arr = []
        for (var i in this.data) {
          if (this.data[i].id == 'banner') {
            let a = this.data[i].data
            for (let j in a) {
              arr.push(a[j]); //属性
            }
            this.titleNViewBackground = arr[index].backgrounds;
          }
        }
      },
      open() {
        this.$refs.popup.open()
      },
      towangzhan() {
        window.location.href = 'http://www.yirenhuigroup.com'
      },
      xieyi() {
        uni.request({
          url: 'http://hszj.hongshantang696.com//app/index.php?i=4&c=entry&m=ewei_shopv2&do=mobile&r=acommsion.tongyi&app=1',
          data: {
            openid: this.openid
          },
          header: {
            'Content-Type': 'application/x-www-form-urlencoded'
          },
          method: 'POST',
          success: res => {
            console.log(res)
            uni.showTabBar({})
          },
          fail: () => {},
          complete: () => {},
        });
      },
      kaituan() {
        uni.request({
          url: 'http://hszj.hongshantang696.com//app/index.php?i=4&c=entry&m=ewei_shopv2&do=mobile&r=member.gettuaninfo&app=1',
          data: {
            openid: this.openid
          },
          header: {
            'Content-Type': 'application/x-www-form-urlencoded'
          },
          method: 'POST',
          success: res => {
            console.log(res)
            this.tuan = res.data
          },
          fail: () => {},
          complete: () => {},
        });
      },
      jump() {
        uni.showModal({
          title: '提示',
          content: '功能即将开放',
          showCancel: false,
          confirmColor: "#DD524D",
          success() {
            return
          }
        })
      },
      jumpgo(e) {
        uni.navigateTo({
          url: e.currentTarget.dataset.src
        });
      },
      jumptomenu(item) {
        if (item.linkurl == "" || item.linkurl == undefined) {
          uni.showModal({
            title: '提示',
            content: '即将开放',
            showCancel: false,
            confirmColor: "#DD524D",
            success() {
              return
            }
          })
          return
        }
        if (item.linkurl != "" || item.linkurl != undefined) { // 跳转到任意页
          console.log(item.linkurl)
          uni.navigateTo({
            url: item.linkurl
          });
          uni.switchTab({
            url: item.linkurl
          })
          return
        }
        // 跳转到文章页
        if (item.linkurl == "../media/media") {
          uni.navigateTo({
            url: '../media/media'
          });
          return
        }
        if (item.linkurl == "../commission/qrcode/invite_code") {
          uni.navigateTo({
            url: '../commission/qrcode/invite_code'
          });
          return
        }
        if (item.linkurl == "../member/member") {
          uni.reLaunch({
            url: '../member/member'
          })
          return
        }
        if (item.linkurl.indexOf("points_mall/points_mall") != -1) { // 余额商城
          uni.navigateTo({
            url: '../../pageA/member/points_mall/points_mall'
          })
          return
        }
        if (item.linkurl == "../commission/qrcode/invite_code") {
          uni.navigateTo({
            url: '../commission/qrcode/invite_code'
          });
          return
        }
        item = item.linkurl
        console.log(item)
        let obj = {};
        let arr1 = item.split("?");
        let arr2 = arr1[1].split("&");
        for (let i = 0; i < arr2.length; i++) {
          let res = arr2[i].split("=");
          obj[res[0]] = res[1];
        }
        item = obj
        // 跳转到自定义页面
        if (item.r == "diypage") {
          uni.navigateTo({
            url: '../goods/spree/spree?id=' + item.id
          });
        }
        if (item.r == "goods.detail") {
          uni.navigateTo({
            url: '../goods/detail?goodsid=' + item.id
          });
        }
        if (item.r == "article") {
          uni.navigateTo({
            url: '../../pageA/essay/essay?essaysid=' + item.aid
          });
        }
        if (item.r == "articlecategory") {
          uni.navigateTo({
            url: '../media/media?id=' + item.id
          });
        }

        if (item.r == "goods") {
          uni.navigateTo({
            url: '../goods/goods?cate=' + item.cate
          });
        }
        if (item.r == "commission.qrcode") {
          uni.navigateTo({
            url: '../commission/qrcode/invite_code'
          });
        }
        if (item.r == "sign") {
          uni.navigateTo({
            url: '../../pageA/member/sign/sign'
          });
        }
      },
      searchgoGoods() {
        uni.reLaunch({
          url: '/pages/cart/cart'
        })
      },
      tozutuan() {
        uni.navigateTo({
          url: '/pages/ctjl/ctjl'
        })
      },
      jumpgoods(e) {
        uni.navigateTo({
          url: '../goods/detail?goodsid=' + e.currentTarget.dataset.id
        });
      },
      hide() {
        this.newLogin = ''
        this.show = ''
      },
      hide1() {
        this.show3 = ''
      },
      download() {
        this.pointerevents = 'none'
        this.link = 'wifi'
        this.dlbtn = '正在下载 0%'
        this.newtext = '正在后台下载，请稍后'
        let _this = this
        var downToak = plus.downloader.createDownload('http://hszj.hongshantang696.com//hongshantang.apk', { //拿到下载任务的对象
          filename: '_doc/update/'
        }, function(d, status) {
          plus.nativeUI.closeWaiting();
          if (status == 200) { //在回调中根据状态 进行操作
            plus.runtime.install(plus.io.convertLocalFileSystemURL(d.filename), {}, {}, function(error) {
              uni.showToast({
                title: '安装失败',
                mask: false,
                duration: 1500
              });
            })
          } else {
            app.alert("配置出错,请检查网络链接！");
          }
        });
        downToak.start(); // 开启下载的任务
        var prg = 0;
        downToak.addEventListener("statechanged", function(task, status) { //给下载任务设置一个监听 并根据状态  做操作
          switch (task.state) {
            case 1:
              break;
            case 2:
              break;
            case 3:
              prg = parseInt(parseFloat(task.downloadedSize) / parseFloat(task.totalSize) * 100);
              _this.dlbtn = '正在下载 ' + prg + '%'
              _this.right = 100 - Number(prg) + '%'
              break;
            case 4:
              break;
          }
        });
      },
    }
  }
</script>

<style lang="scss">
  page {
    background: #fff; // 页面的整体背景色
  }


  .mp-search-box {
    width: 100%;
    height: 145upx;
    position: fixed;
    left: 0;
    top: 0;
    // top: 72upx;
    z-index: 9;

    // padding: 0 80upx;
    // background-color: rgba($color: #BE473F, $alpha: 0.5);
    .ser-input {
      width: 76%;
      height: 56upx;
      // margin-top: 60upx;
      line-height: 56upx;
      text-align: center;
      font-size: 28upx;
      border-radius: 20px;
      background-color: #ddd;
      border: 1px solid #ccc;
    }
  }

  .controls-title {
    width: 100%;
    text-align: center;
    color: #FFFFFF;
  }

  .m-t {
    margin-top: 16upx;
  }

  /* 头部 轮播图 */
  .carousel-section {
    position: relative;

    // margin-top: 20upx;
    .titleNview-placing {
      padding-top: 50px;
      height: var(--status-bar-height);
      box-sizing: content-box;
    }

    .titleNview-background {
      // background: #BE473F; //轮播图后面暂时的静态背景色
      opacity: 0.9;
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 430upx;
      transition: .4s;
    }
  }

  .carousel {
    // #ifdef H5
    margin-top: 70upx;
    // #endif

    width: 100%;
    height: 320upx;
    text-align: center;

    .carousel-item {
      width: 100%;
      height: 100%;
      overflow: hidden;
    }

    image {
      width: 94%; // 设置 轮播图片宽度
      height: 100%;
      border-radius: 10upx;
    }
  }

  .swiper-dots {
    display: flex;
    position: absolute;
    left: 60upx;
    bottom: 30upx;
    width: 72upx;
    height: 36upx;
    background-image: url();
    background-size: 100% 100%;

    .num {
      width: 36upx;
      height: 36upx;
      border-radius: 50px;
      font-size: 24upx;
      color: #fff;
      text-align: center;
      line-height: 36upx;
    }

    .sign {
      position: absolute;
      top: 0;
      left: 50%;
      line-height: 36upx;
      font-size: 12upx;
      color: #fff;
      transform: translateX(-50%);
    }
  }

  /* 分类 */
  .cate-section {
    display: flex;
    justify-content: space-around;
    align-items: center;
    flex-wrap: wrap;
    padding: 30upx 22upx;
    background: #fff;

    .cate-item {
      display: flex;
      flex-direction: column;
      align-items: center;
      // font-size: $font-sm + 2upx;
      // color: $font-color-dark;
    }

    /* 原图标颜色太深,不想改图了,所以加了透明度 */
    image {
      width: 88upx;
      height: 88upx;
      margin-bottom: 14upx;
      border-radius: 50%;
      opacity: .7;
      box-shadow: 4upx 4upx 20upx rgba(250, 67, 106, 0.3);
    }
  }

  .ad-1 {
    width: 100%;
    height: 210upx;
    padding: 10upx 0;
    background: #fff;

    image {
      width: 100%;
      height: 100%;
    }
  }

  .p_father {
    width: 100%;
    height: 330upx;
    display: flex;
    justify-content: space-between;
    margin-bottom: 16upx;
  }

  .p_left {
    margin: 0 10upx;
    width: 40%;
    flex: 1;
  }

  .p_left image {
    width: 100%;
    height: 100%;
  }

  .p_right {
    margin: 0 10upx;
    width: 40%;
    flex: 1;
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;
  }

  .img_top {
    flex: 1;
    height: 50%;
    // height: 170upx;
    width: 100%;
  }

  .img_top image {
    width: 98%;
    height: 98%;
  }

  .img_bottom {
    flex: 1;
    height: 50%;
    // height: 170upx;
    width: 100%;
    display: flex;
  }

  .img_bottom view {
    flex: 1;
    width: 50%;
    line-height: 1;
  }

  .img_bottom view:nth-child(1) image {
    width: 98%;
    height: 98%;
    // margin: 0 4% 4% 0;
  }

  .img_bottom view:nth-child(2) image {
    width: 98%;
    height: 98%;
    // margin: 0 0% 4% 4%;
  }

  .tab_choose {
    height: 100upx;
    display: flex;
    background-color: #fff;
    color: #05052B;
  }

  .padleft {
    color: #333;
    padding-left: 4upx;
  }

  .menu_son {
    line-height: 100upx;
    flex: 1;
    text-align: center;
  }

  .flexbox {
    display: flex;
    flex-wrap: wrap;
  }

  .flexboxson {
    width: 25%;
  }

  .block {
    padding: 8upx;
  }

  .item {
    float: left;
    width: 50%;
    padding: 10upx;
    box-sizing: border-box;
  }

  .one .item {
    width: 100%;
  }

  .three .item {
    width: 33.33%;
  }

  .triangle {
    width: 100%;
    height: 346upx;
    display: block;
  }

  .one .triangle {
    height: 714upx
  }

  .three .triangle {
    height: 224upx
  }

  .detail {
    background: #fff;
    padding: 20upx 12upx;
  }

  .name {
    height: 68upx;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    font-size: 24upx;
    line-height: 36upx;
  }

  .price text {
    display: block;
    line-height: 40upx;
  }

  .price {
    margin-top: 12upx;
    color: #05052B;
  }

  .mask {
    position: fixed;
    z-index: 998;
    top: 0;
    right: 0;
    left: 0;
    bottom: 0;
    background: rgba(0, 0, 0, .6);
  }

  .mask,
  .tips {
    display: none;
  }

  .mask.show,
  .gengxing.show {
    display: block !important;
  }

  .gengxing {
    position: fixed;
    z-index: 99999;
    width: 480upx;
    height: 738upx;
    top: 50%;
    left: 50%;
    margin-left: -240upx;
    margin-top: -380upx;
    background-size: cover;
    display: none;
    overflow: hidden;
  }

  .gengxing .title {
    position: absolute;
    top: 340upx;
    text-align: center;
    color: #db3737;
    font-size: 40upx;
    font-weight: 600;
    width: 220upx;
    left: 50%;
    margin-left: -110upx;
    line-height: 44upx;
    z-index: 999;
  }

  .gengxing .title text {
    font-weight: initial;
    font-size: 24upx;
    color: #fff;
    background: #db3737;
    border-radius: 100upx;
    padding: 0 10upx;
    position: absolute;
    line-height: 36upx;
    bottom: 0;
    left: 100%;
    z-index: 999;
  }

  .dl {
    position: absolute;
    bottom: 0;
    background: transparent;
    font-size: 34upx;
    width: 100%;
    color: #fff;
    line-height: 100upx;
    z-index: 999;
  }


  .d-header {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 80upx;
    // font-size: $font-base + 2upx;
    // color: $font-color-dark;
    position: relative;

    text {
      padding: 0 20upx;
      background: #fff;
      position: relative;
      z-index: 1;
    }

    &:after {
      position: absolute;
      left: 50%;
      top: 50%;
      transform: translateX(-50%);
      width: 300upx;
      height: 0;
      content: '';
      border-bottom: 1px solid #ccc;
    }
  }
</style>
